<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="pro_tech" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="technologyUpSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
      <el-button @click="gotoPage('/mes/product/ProductTechNewFlowAdd?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 增加活动计划 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="产品工艺名称" prop="tech_name">
              <el-input v-model="pro_tech.tech_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="适用产品" prop="">
              {{pro_tech.tech_produce}}
              <el-button @click="popProductTechPartsList('','tech_produce')" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-button @click="gotoPage('/mes/product/ProductTechPartsList?'+vueparams+'')" type='primary' size="mini">保存</el-button>
      <el-button @click="gotoPage('/mes/product/ProductTechNewFlowAdd?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
    </el-form>
    <el-dialog :visible.sync="ProductTechPartsListVisible" append-to-body>
      <ProductTechPartsList v-if="ProductTechPartsListVisible" ref="ProductTechPartsList" :popparams="popparams"> </ProductTechPartsList>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ProductTechPartsList from "@/views/mes/product/ProductTechPartsList";
  export default {
    name: 'TechnologyUp',
    components: {
      ProductTechPartsList,
    },
    props: ['popparams'],
    data() {
      return {
        ProductTechPartsListVisible: false,
        ProductTechPartsListValue: null,
        ProductTechPartsListDesc: null,
        vueparams: this.getVUEParams(""),
        pro_tech: {
          tech_name: null,
          tech_produce: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {},
    updated() {},
    mounted() {},
    methods: {
      technologyUpSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/mes/product/TechnologyAction/technologyUpSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.gotoPage("/mes/product/CartogramTechnology/cartogramTechnology?" + this.vueparams, data);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
      popProductTechPartsList(desc, value) {
        this.ProductTechPartsListVisible = true;
        this.ProductTechPartsListDesc = desc;
        this.ProductTechPartsListValue = value;
      },
      closeProductTechPartsList(value, desc) {
        this.ProductTechPartsListVisible = false;
        this.$set(this.pro_tech, this.ProductTechPartsListDesc, desc);
        this.$set(this.pro_tech, this.ProductTechPartsListValue, value);
      },
    },
  }
</script>
